<template>
	<view>
		<view class="flex justify-between align-center padding relative">
			<view class="flex justify-between align-center w-100">
				<button  class="bg-inherit headimg inline-block margin-0"
					@tap="onChooseAvatar">
					<view v-if="currentObj && currentObj.headimg" class="cu-avatar xl round" :style="'background-image:url('+currentObj.headimg+');'"></view>
					<view v-else>设置头像</view>
				</button>
				<view class="flex flex-direction margin-left-lg justify-around">
					<view class="flex justify-start align-center text-lg">
						<text class="cuIcon-peoplefill text-main "></text>
						<view @tap="onChooseAvatar" class="text-df w-70 phone-button" >{{currentObj.nc}}</view>
					</view>
					<view class="flex justify-start align-center text-lg">
						<text class="cuIcon-phone text-main"></text>
						<!-- <input class="text-df" v-model="currentObj.tel" placeholder="请输入电话" /> -->
						<text v-if="currentObj && currentObj.tel" @tap="getPhoneNumber" class="text-sm phone-button">{{currentObj.tel}}</text>
						<button v-else class="phone-button text-sm" @tap="getPhoneNumber">请输入手机号</button>
					</view>
				</view>
				<view class="relative cu-avatar xl bg-inherit">
					<view v-if="currentObj && currentObj.tx" class="cu-avatar xl round absolute top0 right0"
						:style="'background-image:url('+currentObj.tx+');'"></view>
					<view v-if="currentObj && currentObj.tx"
						class="cu-avatar xl round absolute top0 right0 bg-cover"></view>
					<view 
						class="bg-inherit cu-avatar xl absolute top0 right0 flex justify-center align-center w-100">
						<view @click="openTx" :class="(currentObj && currentObj.tx) ? 'text-red': 'text-main'" class="text-sm flex flex-direction justify-center align-center">
							<text>人脸</text>
							<text>{{(currentObj && currentObj.tx) ? "已设置" : "未设置"}}</text>
						</view>
					</view>
				</view>
			</view>

		</view>
		
	</view>
</template>

<script>
	import upload from "@/wx-cos/upload.js";
	export default {
		data: function() {
			return {
				txurl: "",
				currentObj: {}
			};
		},
		created: function() {
			if (this.store.state.dz) {
				this.currentObj.headimg = this.store.state.dz.cover;
				this.currentObj.nc = this.store.state.dz.dzmc;
				this.currentObj.tel = this.store.state.dz.tel;
				this.currentObj.tx = this.store.state.dz.tx;
			}
		},
		methods: {
			getPhoneNumber: function() {
				this.toRlyz();
			},
			onChooseAvatar: function(e) {
				this.toRlyz();
			},
			openTx: function() {
				this.toRlyz();
			},
			toRlyz: function() {
				uni.navigateTo({
					url: "/pages/cdz/rllr"
				});
			},
		}
	}
</script>

<style scoped>
	.headimg {
		padding-left: 0;
		padding-right: 0;
	}

	.headimg::after {
		border: none;
	}
	
	.phone-button {
		border-style: none;
		background-color: rgba(0, 0, 0, 0);
		padding: 0 0 0 5px;
		margin: 0;
	}
	
	.phone-button::after {
		border-style: none;
		background-color: rgba(0, 0, 0, 0);
	}
</style>